home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c
- Subject: Re: atoi
- Date: 9 Jan 1996 05:10:59 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4cstd3$5a@news.iag.net>
- References: <4cl55i$5bc@news-e2a.gnn.com> <4cnko0$3u3@news.ais.net>
- NNTP-Posting-Host: pm1-orl16.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <4cnko0$3u3@news.ais.net>, joshez@ais.net says...
- >
- >
- >>i know its a dumb question but i really just dont understand
- >>this function.
- >
- >Follow this:
- >
- >int number ;
- >char string[4] = "123";
- >
- >...
- >...
- >...
- >
- >number = atoi(string);
- >
- >
- >String "123" is now integer that can be mathematicaly manipulated.
- >
- >That's all to it.
-
- Wellll.. actually, "123" is still a string literal and string is still a
- char array, whose contents should be {'1', '2', '3', '\0'}. However, the
- value of number should now be 123 (the value returned by atoi, barring any
- strange errors). :-)
-
-
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-